﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using DAO_DTO_WS.DTO;
using DAO_DTO_WS.DAO;
using System.Collections.Generic;
namespace DAO_DTO_WS
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        /*
         * THANH VIEN
        */
        [WebMethod]
        public bool ThanhVien_ThemMoi(ThanhVienDTO thanhVien)
        {

            return ThanhVienDAO.ThemMoi(thanhVien);
        }
        /*
         * DOANH NGHIEP 
        */
        [WebMethod]
        public bool DoanhNghiep_ThemMoi(DoanhNghiepDTO doanhNghiep)
        {

            return DoanhNghiepDAO.ThemMoi(doanhNghiep);
        }
        
        /*
         * SAN PHAM 
        */
        [WebMethod]
        public bool SanPham_ThemMoi(SanPhamDTO sanPham)
        {

            return SanPhamDAO.ThemMoi(sanPham);
        }
        [WebMethod]
        public bool test()
        {
            SanPhamDTO sp = new SanPhamDTO();
            sp.TieuDe = "THU6";
            sp.DiemNoiBat = "FFF";
            sp.DieuKien = "ABCD";
            sp.ThongTin = "Ngu";
            sp.GiaGoc = 1800000;
            sp.GiaTietKiem = 100000;
            sp.SoLuong = 200;
            sp.SoLuongToiThieu = 90;
            sp.MaDiaPhuong = 1;
            sp.MaDoanhNghiep = 1;
            sp.ThoiGianBatDau = new DateTime(1990, 2, 28);
            sp.ThoiGianKetThuc = new DateTime(1990, 6, 6);
            sp.TinhTrang = 0;
            return SanPhamDAO.ThemMoi(sp);
             
        }
        [WebMethod]
        public List<ThanhVienDTO> LayDSThanhVien()
        {
            return ThanhVienDAO.LayDSThanhVien();
        }
        [WebMethod]
        public SanPhamDTO laySPTheoMa(int maSp)
        {
            return SanPhamDAO.laySPTheoMa(maSp);
        }
        [WebMethod]
        public List<SanPhamDTO> layDSSanPham()
        {
            return SanPhamDAO.layDSSanPham();
        }
        [WebMethod]
        public List<SanPhamDTO> laySPTheoTinhTrang(int tinhtrang)
        {
            return SanPhamDAO.laySPTheoTinhTrang(tinhtrang);
        }
        [WebMethod]
        public List<SanPhamDTO> laySPTheoNgay(DateTime ngay)
        {
            return SanPhamDAO.laySPTheoNgay(ngay);
        }
        [WebMethod]
        public ThanhVienDTO LayThanhVien(string tendangnhap)
        {
            return ThanhVienDAO.LayThanhVien(tendangnhap);
        }
        [WebMethod]
        public List<LoiBinhDTO> LayCommentTheoSp(int maSP)
        {
            return LoiBinhDAO.LayCommentTheoSp(maSP);
        }
        [WebMethod]
        public bool ThemLoiBinh(int maTV, int maSP, string noidung)
        {
            return LoiBinhDAO.ThemLoiBinh(maTV, maSP, noidung);
        }

    }
}
